package com.glela.order.util;

import java.util.Comparator;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;

import com.glela.platform.vo.UserPromotionVo;

/**
 * 根据优惠实际金额大小排序
 * @author zls
 *
 */
public class UserPromotionComparator implements Comparator<UserPromotionVo> {

	@Override
	public int compare(UserPromotionVo o1, UserPromotionVo o2) {
		return NumberUtils.compare(o2.getDiscountAmount(), o1.getDiscountAmount()) * 10 + StringUtils.compare(o2.getExpirationTime(), o1.getExpirationTime());
	}

}
